package com.leyou.trade.interceptor;

import com.leyou.auth.utils.UserContext;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.stereotype.Component;

//添加feign的拦截器，加上头部，不然远程调用时候不会像http请求一样加上头部去请求
//就会出现权限不足的情况
@Component
public class JwtInterceptor implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate template) {
        template.header("Cookie", "LY_TOKEN=" + UserContext.getJwt());
    }
}